#ifndef logger_H
#define logger_H 1

//deze word als 1e overal, gebruikt, detecteert hier of het window of linux is
#if defined __CYGWIN32__
	#define _OS_WIN
#else
	#define _OS_OTHER
#endif

//als het windows is, gebruiken we de windows includes
#if defined _OS_WIN
        #include <windows.h>
#endif

#include <fstream>
#include <iostream>
#include <string>
#include <string.h>
#include <time.h>
#include <vector>
#include "HostInfo.h"

using namespace std;

/* 
   the log file has to be accessed from any code
   which includes this header (similiar to cout, cerr, clog, etc..)
*/

class logger;
extern logger dasLog;

// const string SD_DEFAULT_LOGFILE = "simDelta.log";

const int LOG_WRITE  = ios::out;
const int LOG_APPEND = ios::app;

const int EXIT_MSG_SIZE = 512;
const int MAX_EXIT_CODES = 3;

class logger : public ofstream
{

public:

   enum logLevels 
   {
      LEVEL_0,       // buffer all log messages
      LEVEL_1,       // buffer Level one, two and three log messages
      LEVEL_2,       // buffer Level two and three log messages
      LEVEL_3,       // buffer Level three log messages
      QUIET_MODE     // do not print out any messages
   };
 
   logger();
   logger(const string&);
   logger(const string&,enum logLevels);
   ~logger();
   void winClipboardTEMP(const string&);

private:

   void initVars();
   void init(const string&);
   void init(const string&,int);
   void init();

   char* getExecTime();
   void  getExecTime(int*,int*);
   void  openLog(const string&,int);
   //void logger::openLog(const string&, ios_base::openmode);
   void  printHeader(int);
   

private:

   string logName;
   enum logLevels logLevel;
   time_t startTime;

};

const enum logger::logLevels L0 = logger::LEVEL_0;
const enum logger::logLevels L1 = logger::LEVEL_1;
const enum logger::logLevels L2 = logger::LEVEL_2;
const enum logger::logLevels L3 = logger::LEVEL_3;
const enum logger::logLevels LQUIET = logger::QUIET_MODE;

#endif



